// 导入请求哈
import request from '@/utils/request'
// 文章获取内容
const articleWenApi = ({ article_id }) => {
  return request({
    method: 'get',
    url: `/v1_0/articles/${article_id}`
  })
}
// 关注用户
const followingApi = ({ article_id }) => {
  return request({
    method: 'post',
    url: '/v1_0/user/followings',
    data: {
      target: article_id
    }
  })
}
// 取消关注
const unfollowingApi = ({ article_id }) => {
  return request({
    method: 'delete',
    url: `/v1_0/user/followings/${article_id}`
  })
}
// 点赞文章
const attitudeApi = ({ article_id }) => {
  return request({
    method: 'post',
    url: '/v1_0/article/likings',
    data: {
      target: article_id
    }
  })
}
// 取消点赞
const unattitudeApi = ({ article_id }) => {
  return request({
    method: 'delete',
    url: `/v1_0/article/likings/${article_id}`
  })
}
// comment获取评论数据哈
const commentPinApi = ({ artId, offset = null, limit = 10 }) => {
  return request({
    url: '/v1_0/comments',
    params: {
      type: 'a',
      source: artId,
      offset,
      limit
    }
  })
}
// 点赞成功哈
const likeApi = ({ likeid }) => {
  return request({
    url: '/v1_0/comment/likings',
    method: 'post',
    data: {
      target: likeid
    }
  })
}
// 取消点赞成功
const nolikeApi = ({ likeid }) => {
  return request({
    method: 'delete',
    url: `/v1_0/comment/likings/${likeid}`
  })
}
// 品论发布哈
const pulishArticleApi = ({ artId, content }) => {
  return request({
    method: 'post',
    url: '/v1_0/comments',
    data: {
      target: artId,
      content
    }
  })
}
// 导出更好哈
export { pulishArticleApi, articleWenApi, followingApi, unfollowingApi, attitudeApi, unattitudeApi, commentPinApi, likeApi, nolikeApi }
